## -*- coding: utf-8 -*-
<%namespace file="/component/utils.html" import="link_for_user" />
<%!
    from pythonblog.service import user_service
%>
% if h.auth.authorized(h.auth.is_valid_user):
  ${user_nav()}
% else:
  ${signupform()}
% endif

<%def name="user_nav()">
  <div>
      欢迎您，<span id="userName">${user_service.get_user(request.environ['REMOTE_USER']).author}</span>！<a href="${h.url_for_www(controller='account', action='log_out', section_id=c.section_id)}">退出</a>
  </div>
  <div>
      您可以登录您的专区发表文章：${link_for_user(request.environ['REMOTE_USER'], u'我的专区')}
  </div>
</%def>

<%def name="signupform()">
		<form id="signupform" method="post">
		  <table>
		    <tbody>
		      <tr>
		        <td id="errorWrapper" colspan="2" height="0"></td>
		      </tr>		      
		      <tr>
		        <td width="50"><span style="color: red">*</span> <label id="luserName" for="userName">注册名</label></td>
		        <td><input type="text" size="40" class="text" id="userName" name="userName" value=""> </td>
		      </tr>
		      <tr><td height="0"></td><td height="0"></td></tr>
		      <tr>
		        <td><span style="color: red">*</span> <label id="lpassword" for="password">密码</label></td>
		        <td><input type="password" class="text" id="password" name="password" value=""> </td>
		      </tr>
		      <tr><td height="0"></td><td height="0"></td></tr>	
		      <tr>
		       <td></td>
		       <td style="text-align:left">
				   <input type="checkbox" checked="checked" id="remember_me" name="remember_me" />
				   <label id="lremember_me" for="remember_me">自动登录</label>
		       </td>	        
		      </tr>
		      <tr>
		        <td colspan="2" style="padding-left:15px;">
		        <input type="submit" id="btnLogin" class="button" value="登录">
		        <input type="button" id="btnRegister" class="button" onclick="" value="注册">
		        <input type="button" id="btnHelp" class="button" value="会员指南">
		        </td>
		      </tr>
		    </tbody>
		  </table>
		</form>
</%def>
